< previous page page_135 next page >

Page 135
LISTING 6.1.CONTINUED
9f8044bafea36a1f728739c0bb58ef4c.gif
28:     End If
29:
30:     'Delegate to private methods, where only one will be able to
          process the
31:     'message.
32:
33:     Set LocalObject = argObject
34:
35: If returns Then
36:         adjustBalance = returns
37:         Exit Function
38:         Set LocalObject = Nothing
39:     End If
40:
41:     returns = decreaseBalance(LocalObject)
42:     If returns Then
43:         adjustBalance = returns
44:         Exit Function
45:         Set LocalObject = Nothing
46:     End If
47: End Function
48:
49: Private Function increaseBalance(argObject As Object)
50:     'Make sure incoming object is of type Deposit
51:     If TypeName(argObject) <> Deposit Then
52:         increaseBalance = False
53:         Exit Function
54:     End If
55:
56:     'It's a Deposit object
57:     CurrentBalance = CurrentBalance + argObject.Amount
58:     increaseBalance = True
59: End Function
60:
61: Private Function decreaseBalance (argObject As Object)
62:    'Make sure incoming object is of type Withdrawal
63:     If TypeName (argObject) <> Withdrawal Then
64:         decreaseBalance = False
65:         Exit Function
66:     End If
67:
68:     'It's a Withdrawal object
69:    CurrentBalance = CurrentBalance - argObject.Amount
70:    decreaseBalance = True
71: End Function
72:
73: Properties:
74: AccountNumber
75: CurrentBalance

 
< previous page page_135 next page >

If you like this book, buy it!